/*
  SHA-1 Hash Calculator
  Format: SHA1("USERNAME:PASSWORD")

  Similar: http://www.fileformat.info/tool/hash.htm
*/

#include <stdio.h>
#include <stdlib.h>

#include "includes/libm_sha1.h"

int main(int argc, char *argv[])
{
  if (argc != 3)
    {
      printf("SHA-1 Hash MaNGOS Calculator\n");
      printf("Xkyve Software\n");
      printf("Usage: %s <username> <password>\n", argv[0]);
      printf("Example: %s admin pass1\n", argv[0]);
      exit(1);
    }
  
  char hash[41];
  sha1_mangos(argv[1], argv[2], hash, 1);

  if (sha1_valid(hash))
    printf("%s:%s --> %s\n", argv[1], argv[2], hash);
  else
    printf("\"%s\" has encountered an error.\n", argv[0]);
  
  return 0;
}
